package com.example.hospital.patient.wx.api.service.impl;

import com.example.hospital.patient.wx.api.db.dao.UserInfoCardDao;
import com.example.hospital.patient.wx.api.db.pojo.UserInfoCardEntity;
import com.example.hospital.patient.wx.api.service.UserInfoCardService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Map;

@Service
public class UserInfoCardServiceImpl implements UserInfoCardService {
    @Resource
    private UserInfoCardDao userInfoCardDao;

    @Override
    @Transactional
    public void insert(UserInfoCardEntity entity) {
        userInfoCardDao.insert(entity);
    }

    @Override
    public void update(Map data) {
        userInfoCardDao.updateUserInfoCard(data);
    }

    @Override
    public Map getByUserId(Integer userId) {
        return userInfoCardDao.getUserInfoCard(userId);
    }

    @Override
    public boolean hasUserInfoCard(int userId) {
        Integer id = userInfoCardDao.hasUserInfoCard(userId);
        boolean bool = (id != null);
        return bool;
    }
}
